package com.leetCode;

public class TwoSum {
    private int[] targetNum = new int[2];

    public static void main(String[] args) {
        int[] num = {3,3};
        int target = 6;
        TwoSum t = new TwoSum();
        int[] a = t.twoSum(num, target);
        for (int i = 0; i < a.length; i++) {
            System.out.println(a[i]);
        }
    }

    public int[] twoSum(int[] nums, int target) {
        for (int i = 0; i < nums.length - 1; i++) {
            for (int j = i + 1; j < nums.length; j++) {
                if (nums[i] + nums[j] == target) {
                    targetNum[0] = i;
                    targetNum[1] = j;
                    return targetNum;
                }
            }
        }
        return targetNum;

    }

}
